package com.cai.xiaobai.controller;


import com.cai.xiaobai.entity.DTO.answerInfo.fillInFrom.FillInFromVO;
import com.cai.xiaobai.result.R;
import com.cai.xiaobai.result.Result;
import com.cai.xiaobai.service.IAnswerInfoService;
import com.cai.xiaobai.utils.TokenUtil;
import com.cai.xiaobai.utils.common.AuthUtil;
import io.jsonwebtoken.Claims;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 答案数据表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-05-13
 */
@RestController
@RequestMapping("/answer-info")
@AllArgsConstructor
@Tag(name = "填写问卷数量")
public class AnswerInfoController {
    private final IAnswerInfoService iAnswerInfoService;

    @GetMapping("/getHistory")
    @Operation(summary = "查询查询用户自己的历史记录或者查询问卷的填写情况")
    public Result getHistory(String openId) {
        return iAnswerInfoService.getHistory(openId);
    }


    @PostMapping
    @Operation(summary = "填写问卷")
    public Result fillInFrom(@RequestBody FillInFromVO fillInFromVO) {
        return iAnswerInfoService.fillInFrom(fillInFromVO);
    }
}
